<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 需求1
      let arr = [1, 3, 5, 7, 9, 10, 40, 60, 70, 80, 90, 100]
      let count = 0
      let count2 = 0
      let sum = 0
      for (let i = 0; i <= arr.length - 1; i++) {
        let num = arr[i]
        if (num % 2 === 0 && num % 3 === 0) {
          document.write(num + '能被3和2整除' + '<br>')
          count++
        }
        // 需求2
        let num2 = arr[i]
        if (num2 % 2 !== 0 && num2 % 3 === 0) {
          sum += num2
          count2++
        }
      }
      document.write('该数组中能被3和2整除的个数为' + count + '<br><br>')

      // for (let j = 0; j <= arr.length - 1; j++) {
      //

      // }
      document.write(`能被3整除，不能被2整除的累加和为${sum}<br>`)
      document.write(`能被3整除，不能被2整除的累加和的平均值为${sum / count2}`)
    </script>
  </body>
</html>
